CLASS=vutinfth
TEX=thesis

all: $(TEX)

$(TEX): $(CLASS).cls
	@echo "\n===\nmaking $@\n===\n"
	pdflatex --shell-escape $@
	bibtex   $@
	pdflatex --shell-escape $@
	pdflatex --shell-escape $@
	makeindex -t $@.glg -s $@.ist -o $@.gls $@.glo
	makeindex -t $@.alg -s $@.ist -o $@.acr $@.acn
	makeindex -t $@.ilg -o $@.ind $@.idx
	pdflatex --shell-escape $@
	pdflatex --shell-escape $@
	@echo "\n===\ncompiled $@\n===\n"

$(CLASS).cls: $(CLASS).dtx
	@echo "\n===\nmaking $@\n===\n"
	pdflatex --shell-escape $^
	pdflatex --shell-escape $^
	makeindex -s gglo.ist -o $(CLASS).gls $(CLASS).glo
	makeindex -s gind.ist -o $(CLASS).ind $(CLASS).idx
	pdflatex --shell-escape $^
	pdflatex --shell-escape $^
	pdflatex --shell-escape $(CLASS).ins
	@echo "\n===\ncompiled $@\n===\n"

spellcheck:
	aspell -c -t $(TEX).tex -d en_US

clean:
	rm -rf *.acn *.acr *.alg *.aux *.bbl *.blg *.glg *.glo *.gls *.glsdefs *.ist *.loa *.lof *.lot *.cls *.hd *.idx *.ilg *.ind *.log *.out *.toc *.pdf *.fdb_latexmk *.fls *.synctex.gz *.lol *.bak _minted-*

.PHONY: all $(TEX) clean
